package com.whmskj.xjlhsc.mapper;

import com.whmskj.xjlhsc.mobie.equipmentManage.entity.vo.ElectricalEnergyDataVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ScDbRealtimeMapper {
    /*create table sc_db_realtime
(
    ID            int auto_increment
        primary key,
    DeviceId      int                                not null,
    MESID         int                                null comment '对应业务表的ID',
    Machinenumber varchar(50)                        null comment '机台号',
    TimeStamp     datetime default CURRENT_TIMESTAMP null,
    DeviceState   varchar(50)                        null comment '设备状态',
    sj001         varchar(50)                        null comment 'A相电压UaV',
    sj002         varchar(50)                        null comment 'B相电压UbV',
    sj003         varchar(50)                        null comment 'C相电压UcV',
    sj004         varchar(50)                        null comment '线电压UabV',
    sj005         varchar(50)                        null comment '线电压UbcV',
    sj006         varchar(50)                        null comment '线电压UcaV',
    sj007         varchar(50)                        null comment 'A相电流IaA',
    sj008         varchar(50)                        null comment 'B相电流IbA',
    sj009         varchar(50)                        null comment 'C相电流IcA',
    sj010         varchar(50)                        null comment '电压变化PT',
    sj011         varchar(50)                        null comment '电流变化CT',
    sj012         varchar(50)                        null comment '功率符号位Sign',
    sj013         varchar(50)                        null comment '开关量输入DI',
    sj014         varchar(50)                        null comment '开关量输出DO',
    sj015         varchar(50)                        null comment 'A相有功功率PaKW',
    sj016         varchar(50)                        null comment 'B相有功功率PbKW',
    sj017         varchar(50)                        null comment 'C相有功功率PcKW',
    sj018         varchar(50)                        null comment '合相有功功率PsKW',
    sj019         varchar(50)                        null comment 'A相无功功率QaKVar',
    sj020         varchar(50)                        null comment 'B相无功功率QbKVar',
    sj021         varchar(50)                        null comment 'C相无功功率QcKVar',
    sj022         varchar(50)                        null comment '合相无功功率QsKVar',
    sj023         varchar(50)                        null comment 'A相视在功率SaKva',
    sj024         varchar(50)                        null comment 'B相视在功率SbKva',
    sj025         varchar(50)                        null comment 'C相视在功率ScKva',
    sj026         varchar(50)                        null comment '合相视在功率SsKva',
    sj027         varchar(50)                        null comment 'A相功率因数PFaHZ',
    sj028         varchar(50)                        null comment 'B相功率因数PfbHZ',
    sj029         varchar(50)                        null comment 'C相功率因数PfcHZ',
    sj030         varchar(50)                        null comment '合相功率因数PfsHZ',
    sj031         varchar(50)                        null comment '电网频率FRHZ',
    sj032         varchar(50)                        null comment '一次侧正向有功电能WPPKWh',
    sj033         varchar(50)                        null comment '一次侧负向有功电能WPNKWh',
    sj034         varchar(50)                        null comment '一次侧正向无功电能WQPKWh',
    sj035         varchar(50)                        null comment '一次侧负向无功电能WQNKWh',
    sj036         varchar(50)                        null comment '二次侧正向有功电能EPPKWh',
    sj037         varchar(50)                        null comment '二次侧负向有功电能EPNKWh',
    sj038         varchar(50)                        null comment '二次侧正向无功电能EQPKWh',
    sj039         varchar(50)                        null comment '二次侧负向无功电能EQNKWh'
)
    row_format = DYNAMIC;*/
    @Select("SELECT a.sj036  AS totalEnergy,\n" +
            "       a.sj011  AS currentCurrent,\n" +
            "       a.sj010  AS currentVoltage,\n" +
            "       a.sj018  AS currentPower,\n" +
            "       a.sj001  AS aVoltage,\n" +
            "       a.sj007  AS aCurrent,\n" +
            "       a.sj002  AS bVoltage,\n" +
            "       a.sj008  AS bCurrent,\n" +
            "       a.sj003  AS cVoltage,\n" +
            "       a.sj009  AS cCurrent,\n" +
            "       a.sj026  AS totalApparentPower,\n" +
            "       b.energy AS shiftEnergy\n" +
            "FROM sc_db_realtime a\n" +
            "         inner join shachang_sb_Energy_dissipation_shift b\n" +
            "                    on a.MESID = b.dbid and b.MESID = #{mesId}\n" +
            "order by b.day\n" +
            "limit 1")
    List<ElectricalEnergyDataVO> getElectricalEnergyDataVO(Integer mesId);
    /*//当前电流
    private Double currentCurrent;
    //当前电压
    private Double currentVoltage;
    //当前功率
    private Double currentPower;
    //A相电压
    private Double aVoltage;
    //A相电流
    private Double aCurrent;
    //B相电压
    private Double bVoltage;
    //B相电流
    private Double bCurrent;
    //C相电压
    private Double cVoltage;
    //C相电流
    private Double cCurrent;
    //总视在功率
    private Double totalApparentPower;*/
}
